package com.cmonbaby.adapter;

import com.cmonbaby.adapter.pattern.SwipeCreate;

/**
 * 创建SwipeRefresh的工厂
 * @author simon 2016-12-16 上午11:05:29
 * @since JDK1.8 SDK6.0.1
 * @version V2.3.5
 */
public class SwipeFactory {

    /**
     * 创建SwipeListener实例，通过SwipeCreate实例和OnSwipeListener实例来创建
     *
     * @param create SwipeCreate创建接口
     * @param listener onRefresh显示接口
     * @return 下拉刷新的处理类
     */
    public static SwipeListener createSwipeHelper(SwipeCreate create, SwipeListener.OnSwipeListener listener) {
        return new SwipeListener.Builder()
                .swipeRefresh(create.findSwipeRefresh()) // 下拉刷新
                .colorRes(create.colorRes()) // 下拉颜色
                .swipeListener(listener) // onRefresh监听
                .build();
    }
}
